/*
 * $Id: $
 */
package org.rcgwt.client.ui.grid.internal;

import org.rcgwt.client.ui.grid.internal.model.IElementModel;
import org.rcgwt.client.ui.grid.internal.model.IGroupModel;
import org.rcgwt.client.ui.grid.internal.model.IGroupTitleModel;

/**
 * 
 * @author Olivier Oeuillot (latest modification by $Author: $)
 * @version $Revision: $ $Date: $
 */
public class GroupTitleModel extends AbstractElementModel implements IGroupTitleModel {

    private final IGroupModel groupModel;

    private final Position position;

    protected GroupTitleModel(IGroupModel groupModel, Position position) {
        this.groupModel = groupModel;
        this.position = position;
    }

    @Override
    public IGroupModel getGroupModel() {
        return groupModel;
    }

    @Override
    public Position getPosition() {
        return position;
    }

    @Override
    public IElementModel getParent() {
        return getGroupModel();
    }

    @Override
    public Type getType() {
        return Type.GROUP_TITLE;
    }

    @Override
    protected void constructKey(IKey key) {
        super.constructKey(key);

        groupModel.appendKey(key);
    }

}
